<template>
    <view class="STH_title_box clearfix">
        <image :class="prop.Flogourl == '' ? hidden : ''" :src="prop.Flogourl"></image>
        <text>{{ prop.titleVal }}</text>

        <label v-if="isShow == 1" @tap="link" class="more">
            {{ prop.rightVal }}
            <i class="icon kxfont icon-gengduo"></i>
        </label>
    </view>
</template>

<script>
// component/title/title.js
var util = require('../../utils/util.js');
export default {
    data() {
        return {
            prop: null,
            isShow: 0,
            hidden: ''
        };
    },
    /**
     * 组件的属性列表
     */
    props: {
        con: {
            type: Object,
            default: null
        }
    },
    mounted() {
        // 处理小程序 ready 生命周期
        this.$nextTick(() => this.ready());
    },
    /**
     * 组件的方法列表
     */
    methods: {
        ready: function () {
            var that = this;
            var prop = JSON.parse(that.con.prop);
            that.prop = prop ;
            var data = that.con.ItemList;
            if (data.length > 0) {
                var row = data[0];
                if (!util.isEmpty(row.Ftypeid)) {
                    that.isShow = 1 ;
                }
                console.log(that.isShow);
            }
        },

        //点击跳转
        link: function (e) {
            var that = this;
            var data = that.con.ItemList;
            if (data.length > 0) {
                var row = data[0];
                // 1=微页面 2=商品分类 3=单商品 4=闪购活动 5=团购活动 6=拼团活动  7=优惠券
                var url = '';
                if (util.isEmpty(row.Ftypeid)) {
                    return;
                }
                if (row.Ftype == 1) {
                    url = '/pages/wpage/wpage?Ftypeid=' + row.Ftypeid;
                } else if (data.Ftype == 2) {
                    //商品分类
                    url = '/pages/proList/proList?Ftypeid=' + row.Ftypeid;
                }
                if (url == '') {
                    return;
                }
                uni.navigateTo({
                    url: url
                });
            }
        }
    },
    created: function () {}
};
</script>
<style>
@import './title.css';
</style>
